package cn.tedu.boot01.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BMIController {
    @RequestMapping("/bmi")
    public String bmi(double height, double weight) {
        double bmivalue =weight / (height * height);
        String result;
        if(bmivalue <= 18.5) {
            result = "偏瘦";
        } else if(bmivalue <= 24) {
            result = "正常";
        } else if(bmivalue <= 27) {
            result = "微胖";
        }else {
            result = "有点胖了";
        }
        return "BMI值为:" + bmivalue + "," + result;
    }
}
